package com.laoliu.example.generate.core.impl;

import com.laoliu.example.generate.bean.vo.GenerateParamVO;
import com.laoliu.example.generate.constant.CodeGeneratorConst;
import com.laoliu.example.generate.core.generate.ControllerGenerator;
import com.laoliu.example.generate.core.generate.ModelAndMapperGenerator;
import com.laoliu.example.generate.core.generate.ServiceGenerator;
import com.laoliu.example.generate.core.itf.GenerateService;
import org.springframework.stereotype.Service;

@Service
public class GenerateServiceImpl implements GenerateService {

    @Override
    public void delete() {

    }

    @Override
    public void generate(GenerateParamVO vo) {
        CodeGeneratorConst.initPackage(vo);
        String tableName = vo.getTableName();
        new ModelAndMapperGenerator().genCode(tableName);
        new ServiceGenerator().genCode(tableName,vo.isFgReBuildService());
        new ControllerGenerator().genCode(tableName,vo.isFgReBuildController());
    }
}
